package application.services;

import application.model.PluginsModel;
import application.translators.Translator;
import application.translators.impl.PluginsTranslator;
import dao.PluginsDao;
import mappings.Plugins;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import java.util.List;

@Path("plugins")
public class PluginsService
{
    private PluginsDao pluginsDao = new PluginsDao();
    private Translator<List<Plugins>, PluginsModel> translator = new PluginsTranslator();

    @Path("getAllPlugins")
    @GET
    @Produces(MediaType.APPLICATION_XML)
    public PluginsModel getAllPlugins()
    {
        return translator.translate(pluginsDao.getAllPlugins());
    }
}
